﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

// 战斗场景UI控制器(与场景逻辑对接)
public class FightUIMgr : Singleton<FightUIMgr>
{
    PlantPanel _plantPanel;
    TouchScene _touchScene;

    public void Init()
    {
        if (_plantPanel == null)
        {
            _plantPanel = new PlantPanel();
            _plantPanel.Init();
        }
        if (_touchScene == null)
        {
            _touchScene = new TouchScene();
            _touchScene.Init();
        }
    }

    // 设置植物列表
    internal void SetPlantList(List<int> list)
    {
        if (_plantPanel == null) { return; }

        _plantPanel.SetCard(list);
    }

    // 点击了场景
    public void SetTouchSceneCallback(Action<Vector3> callback)
    {
        if (_touchScene == null) { return; }

        _touchScene.OnTouchSth = callback;
    }

    // 选中待种植植物
    public void SetSelectPlantToGrowCallback(Action<int> callback)
    {
        if (_plantPanel == null) { return; }

        _plantPanel.OnSelectPlant = callback;
    }

    // 反向回调（场景调UI）
    internal void FillGrowEndCallback(ref Action onGrowEnd)
    {
        if (_plantPanel == null) { return; }

        onGrowEnd = _plantPanel.GrowEnd;
    }
}

